package org.apache.solr.ocean.core;

import java.io.File;
import java.net.URL;

import org.apache.commons.io.FileUtils;
import org.apache.solr.ocean.util.XMLUtil;
import org.jdom.Element;

public class OceanConfig {
  private int serverNumber;
  private URL url;
  
  public OceanConfig(Element element) {
    serverNumber = XMLUtil.getChildInteger("serverNumber", element);
    url = XMLUtil.getChildURL("url", element);
  }
  
  public static OceanConfig load(File file) throws Exception {
    Element element = XMLUtil.parseElement(file);
    OceanConfig oceanConfig = new OceanConfig(element);
    return oceanConfig;
  }
  
  public URL getUrl() {
    return url;
  }
  
  public int getServerNumber() {
    return serverNumber;
  }
}
